<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Class Index extends MY_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->checkUser($this->session->userdata('user_id'));
        $this->data['controller'] = 'index';
        $this->load->model('Mindex');
        $data = array('loadaudio' => 0);
        $this->session->set_userdata($data);
    }
    
    
	public function updateScore()
	{
		$id_ques = $this->getParamInt('id_ques');
		$kq = $this->getParamInt('kq');
        $campaign = $this->session->userdata('number_gameShow');
		$this->data['data'] = $this->Mindex->verifyAnswer($id_ques, $kq, $campaign, $this->session->userdata('user_id'));
		
		$this->data['action'] = 'updatescore';
        $this->load->view('template/index/updatescore', $this->data);
	}
    
    public function showResults()
	{
		$this->data['data'] = $this->Mindex->showResultsDb($this->session->userdata('user_id'));
		
        $this->data['action'] = 'showresult';
        $this->load->view('template/index/showresult', $this->data);
	}
	
	public function finalResults()
	{
		$this->data['data'] = $this->Mindex->finalResultsDb($this->session->userdata('user_id'));
		
		$this->data['action'] = 'finalresult';
        $this->load->view('template/index/finalresult', $this->data);
	}
}
